package com.songyl.logistic;

import java.math.BigDecimal;

public class Functions {
    public static void main(String[] args) {


        double x = new   BigDecimal(-10.00).setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();
        double y;
        for (;x < 10; x=add(x,0.01)) {
            y=Math.pow(x,2);
            System.out.println("x = "+x+",y = "+y);

        }


    }

    /**
     * @param v1
     *           double
     * @param v2
     *            double
     * @return double
     * */
    public static double add(double v1, double v2) {
        BigDecimal b1=new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return (double)b1.add(b2).setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}
